//
//  KnowMorePushView.m
//  NewPro
//
//  Created by 何荧红 on 2019/1/21.
//  Copyright © 2019 何荧红. All rights reserved.
//

#import "KnowMorePushView.h"

@interface KnowMorePushView ()

@property (nonatomic, strong) UIView *SubView;
@property (nonatomic, strong) UILabel *SubCount;
@property (nonatomic, strong) UITextView *DetailLab;


@end


@implementation KnowMorePushView
- (void)setDetail:(NSString *)detail{
    _detail = detail;
    _DetailLab.text = _detail;
}
- (void)setConttitle:(NSString *)conttitle{
    _conttitle = conttitle;
    _SubCount.text = _conttitle;
}

- (instancetype)init{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];
        self.frame = CGRectMake(0, 1000, SCREEN_WIDTH, SCREEN_HEIGHT);
        [self CleanWithView];
    }
    return self;
}
- (void)CleanWithView{
    self.SubView = [[UIView alloc]init];
    _SubView.backgroundColor = [UIColor whiteColor];
    [self addSubview:_SubView];
    [_SubView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.bottom.equalTo(self.mas_bottom);
        make.height.mas_equalTo(240);
    }];
    self.SubCount = [[UILabel alloc]init];
    _SubCount.font = [UIFont fontWithName:@"PingFangSC-Semibold" size:15];
    _SubCount.textColor = [UIColor colorWithHexString:@"333333"];
    [_SubView addSubview:_SubCount];
    [_SubCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.SubView).offset(14);
        make.top.equalTo(self.SubView.mas_top);
        make.height.mas_equalTo(50);
    }];
    UIButton *remove = [[UIButton alloc]init];
    [remove addTarget:self action:@selector(ViewPull) forControlEvents:UIControlEventTouchUpInside];
    [self.SubView addSubview:remove];
    [remove mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.SubView.mas_top);
        make.right.equalTo(self.SubView.mas_right).offset(-14);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(50);
    }];
    UIImageView *img = [[UIImageView alloc]init];
    img.image = [UIImage imageNamed:@"划拨右上角灰色叉"];
    [self.SubView addSubview:img];
    [img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(remove.mas_centerX);
        make.centerY.equalTo(remove.mas_centerY);
        make.width.mas_equalTo(12);
        make.height.mas_equalTo(12);
    }];
    UIView *line = [[UIView alloc]init];
    line.backgroundColor = [UIColor colorWithHexString:@"f5f5f5"];
    [self.SubView addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.SubCount.mas_bottom);
        make.left.equalTo(self.SubView.mas_left);
        make.right.equalTo(self.SubView.mas_right);
        make.height.mas_equalTo(1);
    }];
    self.DetailLab = [[UITextView alloc]init];
    _DetailLab.editable = NO;
    _DetailLab.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    _DetailLab.textColor = [UIColor colorWithHexString:@"666666"];
    [self.SubView addSubview:_DetailLab];
    [_DetailLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(line.mas_bottom).offset(15);
        make.left.equalTo(self.SubView.mas_left).offset(14);
        make.right.equalTo(self.SubView.mas_right).offset(-14);
        make.bottom.equalTo(self.SubView.mas_bottom).offset(-15);
    }];
}

- (void)ViewPush{
    self.hidden = NO;
    [UIView animateWithDuration:0.3 animations:^{
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
    }];
}
- (void)ViewPull{
    [UIView animateWithDuration:0.3 animations:^{
        self.frame = CGRectMake(0, 1000, SCREEN_WIDTH, SCREEN_HEIGHT);
    }];
    self.hidden = YES;
}



@end
